<template>
    <div>
            <Card>
                <p slot="title">
				    订单详情
			    </p>
                <div>
                    <Form class="step-form" ref="orderData" :model="orderData" :label-width="100">

                        <Row span="24">
                            <i-col span="20" >
                                <FormItem label="订单进度："  label-position="left" :label-width="150">
                                    <Progress :percent="25" status="active">已支付</Progress>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="8" >
                                <FormItem label="订单编号：" label-position="left" :label-width="150">
                                     {{orderData.order_no}}
                                </FormItem>
                            </i-col>
                            <i-col span="6" >
                                <FormItem  label="意向金额：" label-position="left" :label-width="150">
                                     {{orderData.intention_money}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="4" >
                                <FormItem  label="品牌名称：" label-position="left" :label-width="150">
                                     {{orderData.source_brand}}
                                </FormItem>
                            </i-col>
                            <i-col span="9" >
                                <FormItem  label="车型：" label-position="left" :label-width="150">
                                   {{orderData.source_model}}
                                </FormItem>
                            </i-col>
                            <i-col span="3" >
                                <FormItem  label="指导价：" label-position="left" :label-width="100">
                                   {{orderData.guidance_price}}
                                </FormItem>
                            </i-col>
                            <i-col span="3" >
                                <FormItem  label="优惠价：" label-position="left" :label-width="100">
                                   {{orderData.price}}
                                </FormItem>
                            </i-col>
                            <i-col span="4" >
                                <FormItem  label="上牌地：" label-position="left" :label-width="100">
                                   {{orderData.province}}-{{orderData.city}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="8" >
                                <FormItem  label="外观颜色：" label-position="left" :label-width="150">
                                     {{orderData.out_color}}
                                </FormItem>
                            </i-col>
                            <i-col span="6" >
                                <FormItem label="内饰颜色：" label-position="left" :label-width="150">
                                   {{orderData.in_color}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="8" >
                                <FormItem  label="下游公司：" label-position="left" :label-width="150">
                                     {{orderData.user_party}}
                                </FormItem>
                            </i-col>
                            <i-col span="6" >
                                <FormItem label="下游个人：" label-position="left" :label-width="150">
                                   {{orderData.user_name}}
                                </FormItem>
                            </i-col>
                            <i-col span="6" >
                                <FormItem  label="联系电话：" label-position="left" :label-width="150">
                                   {{orderData.user_phone}}
                                </FormItem>
                            </i-col>
                        </Row>

                        <Row span="24">
                            <i-col class='small-title' span="2" >
                                支付记录
                            </i-col>
                        </Row>
                        <Row span="24">
                            <div style='margin-top:20px;'>
                                <Table border :columns="pay_columns" :data="pay_data"></Table>
                            </div>
                        </Row>
             
                        <Row span="24" style='margin-top:20px;'>
                            <i-col class='small-title' span="2" >
                                已推送车源
                            </i-col>
                            <i-col style='color:#3399ff;'  span="1" >
                                <span @click="push_refresh()">刷新</span>
                            </i-col>
                            <i-col style='color:#3399ff;'  span="3" >
                                <span @click="push_message()">手动推送</span>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <div style='margin-top:20px;'>
                                <Table border :columns="push_columns" :data="push_data"></Table>
                                <Page ref="pages" :total="push_count" show-total style="float: right; margin-top: 20px" @on-change="pushDataList"></Page>
                            </div>
                        </Row>

                        <Row span="24">
                            <i-col class='small-title' span="2" >
                                反馈车源
                            </i-col>
                            <i-col style='color:#3399ff;' span="1">
                                <span @click="feedback_refresh()">刷新</span>
                            </i-col>
                            <!--<i-col style='color:#3399ff;' span="2" >
                               <span @click="addCarSource()">新增车源</span>
                            </i-col>-->
                            <i-col style='color:#3399ff;' span="2" >
                               <span @click="carOfferShow()">发布寻车</span>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <div style='margin-top:20px;'>
                                <Table border :columns="feedback_columns" :data="feedback_data"></Table>
                            </div>
                            <Page ref="pages" :total="feedback_count" show-total style="float: right; margin-top: 20px" @on-change="feedbackList"></Page>
                        </Row>
                        
                        
                        <FormItem >
                            <!--<Button :disabled="hasSubmit" @click="updateData" style="width:100px;" type="primary">提交</Button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
                            <Button :disabled="hasSubmit" @click="goBack" style="width:100px;" type="primary">去首页</Button>
                        </FormItem>
                    </Form>
                </div>
            </Card>
            <Modal v-model="testModel" title="二次确认信息" :width="600"  :mask-closable="false">
                <div class="clearfix">
                    <Form class="step-form" ref="followData" :model="followData" :rules="followDataRules"  :label-width="100">
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="最终价格：" prop="PRICE"  label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="followData.PRICE" type="text" placeholder="请输入最终价格。单位：万元" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="定金：" prop="DOWN_PAYMENT" label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="followData.DOWN_PAYMENT" type="text" placeholder="请输入定金" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="物流金额：" prop="DOWN_PAYMENT" label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="followData.LOGISTICS_PRICE" type="text" placeholder="请输入物流金额" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="出库费：" prop="OUT_PRICE" label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="followData.OUT_PRICE" type="text" placeholder="请输入出库费" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="可否跨区：" label-position="left" :label-width="100">
                                   <Radio-group v-model="followData.IS_OTHER_AREA">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="是否到店：" label-position="left" :label-width="100">
                                   <Radio-group v-model="followData.IS_WENT_STORE">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="9" >
                                <FormItem prop="" label="车源所在地：" label-position="left" :label-width="100">
                                    <Select style="width:150px" label-in-value >
                                        <Option @click.native="setArea(item)" v-for="(item,index) in areaList" :value="item.cityCode" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="9" >
                                <FormItem prop="" label="" label-position="left" :label-width="0">
                                    <Select clearable style="width:150px" v-model="followData.CAR_LOCATION" >
                                        <Option v-for="(item,index) in areaCityList" :value="item.cityName" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="配送方式：" label-position="left" :label-width="100">
                                   <Radio-group v-model="followData.DELIVERY_TYPE">
                                        <Radio :label="1">加配</Radio>
                                        <Radio :label="2">送配</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="添加装饰：" label-position="left" :label-width="100">
                                   <Radio-group v-model="followData.IS_DECORATION">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="现车/预定详情：" prop="RESERVE_INFO" label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.RESERVE_INFO" type="textarea" placeholder="请输入现车/预定详情" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="保险详情：" prop="INSURANCE_INFO" label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.INSURANCE_INFO" type="textarea" placeholder="请输入保险详情" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="金融详情：" prop="FINANCE_INFO" label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.FINANCE_INFO" type="textarea" placeholder="请输入金融" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="手续："  label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.PROCEDURES" type="textarea" placeholder="请输入手续" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="生产日期："  label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.PRODUCT_TIME" type="textarea" placeholder="请输入生产日期" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="备注：" label-position="left" :label-width="100">
                                    <Input :maxlength="100" :disabled="hasSubmit" v-model="followData.REMARK" type="textarea" placeholder="请输入备注信息" />
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
                <div slot="footer">
                    <div>
                        <Button :disabled="hasSubmit" type="success" style="margin:0 auto; display: block;" @click="confirmation()">确认成功</Button>
                        <!-- <Button type="primary" @click="hideModel">取消</Button> -->
                    </div>
                </div>
            </Modal>
            <Modal v-model="offerDataModel" title="数据详情" :width="600"  :mask-closable="false">
                <div class="clearfix">
                    <Form class="step-form" ref="offerData" :model="offerData"  :label-width="100">
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="价格："  label-position="left" :label-width="100">
                                    <Input v-model="offerData.price" type="text" placeholder="请输入价格" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="优惠金额：" label-position="left" :label-width="100">
                                    <Input v-model="offerData.discount_AMT" type="text" placeholder="请输入优惠金额" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="加价金额：" prop="DOWN_PAYMENT" label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="offerData.add_AMT" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="加价点数：" label-position="left" :label-width="100">
                                    <Input :disabled="hasSubmit" v-model="offerData.add_POINT" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="优惠点数：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.discount_POINT" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="车源方：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.source_NAME" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="经销商名称：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.dealer_NAME" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人职务：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.docking_POST" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人姓名：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.docking_PERSON" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人电话：" label-position="left" :label-width="100">
                                    <Input  v-model="offerData.docking_PHONE" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="是否有现车：" label-position="left" :label-width="100">
                                   <Radio-group v-model="offerData.is_AVAILABLE">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想店内办交强险,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="offerData.is_COMPULSORY_INSURANCE">
                                        <Radio :label="0">可以</Radio>
                                        <Radio :label="1">不可以</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想店内办商业险,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="offerData.is_COMMERICIAL_INSURANCE">
                                        <Radio :label="0">可以</Radio>
                                        <Radio :label="1">不可以</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想本人到店,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="offerData.is_WENT_STORE">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="备注：" label-position="left" :label-width="100">
                                    <Input :maxlength="100"  v-model="offerData.remark" type="textarea"/>
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
            </Modal>
            <Modal v-model="pushMessageModel" title="推送设置" :width="600" :mask-closable="true">
                <div class="clearfix">
                    <Form class="step-form" :model="pushMessage"  :label-width="100">
                        <Row span="12">
                            <i-col span="6" >
                                <FormItem prop="PARTY_ID" label="企业选择：" label-position="left" :label-width="150">
                                    <Select style="width:200px"  label-in-value >
                                        <Option @click.native="setPartyUser(item)" v-for="(item,index) in partys" :value="item.id" :key="index" :label="item.name">{{ item.name }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="6" >
                                <FormItem  label="人员选择："  label-position="left" :label-width="150">
                                    <Select clearable style="width:200px">
                                        <Option @click.native="defineUser(item)" v-for="(item,index) in users" :value="item.id" :key="index" :label="item.realName">{{ item.realName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
                <div slot="footer">
                    <div>
                        <Button :disabled="hasSubmit" type="success" style="margin:0 auto; display: block;" @click="confirmPush()">确认推送</Button>
                        <!-- <Button type="primary" @click="hideModel">取消</Button> -->
                    </div>
                </div>
            </Modal>
            <Modal v-model="carOfferModel" title="寻车报价" :width="600"  :mask-closable="false">
                <div class="clearfix">
                    <Form class="step-form" :model="carOfferData"  :label-width="100">
                        <Row span="12">
                            <i-col span="6">
                                <FormItem  label="企业选择：" label-position="left" :label-width="100">
                                    <Select style="width:200px"  label-in-value >
                                        <Option @click.native="setPartyUser(item)" v-for="(item,index) in partys" :value="item.id" :key="index" :label="item.name">{{ item.name }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="6" >
                                <FormItem  label="人员选择："  label-position="left" :label-width="100">
                                    <Select clearable style="width:200px">
                                        <Option @click.native="carOfferUser(item)" v-for="(item,index) in users" :value="item.id" :key="index" :label="item.realName">{{ item.realName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="店内报价："  label-position="left" :label-width="100">
                                    <Input  v-model="carOfferData.price" type="text" placeholder="请输入报价（单位：万元）" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="备注：" label-position="left" :label-width="100">
                                    <Input  v-model="carOfferData.remark" type="text" placeholder="请输入备注信息" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="车源方名称：" label-position="left" :label-width="100">
                                    <Input   v-model="carOfferData.sourceName" type="text" placeholder="请输入车源方名称"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="经销商名称：" label-position="left" :label-width="100">
                                    <Input   v-model="carOfferData.dealerName" type="text" placeholder="请输入经销商名称"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人职务：" label-position="left" :label-width="100">
                                    <Input  v-model="carOfferData.dockingPost" type="text" placeholder="请输入经对接人职务"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人姓名：" label-position="left" :label-width="100">
                                    <Input  v-model="carOfferData.dockingPerson" type="text" placeholder="请输入对接人姓名"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="对接人电话：" label-position="left" :label-width="100">
                                    <Input  v-model="carOfferData.dockingPhone" type="text" placeholder="请输入对接人姓名"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="是否有现车：" label-position="left" :label-width="100">
                                   <Radio-group v-model="carOfferData.isAvailable">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="是否可以销售到该地区：" label-position="left" :label-width="100">
                                   <Radio-group v-model="carOfferData.isSellArea">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想店内办交强险,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="carOfferData.isCompulsoryInsurance">
                                        <Radio :label="0">可以</Radio>
                                        <Radio :label="1">不可以</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想店内办商业险,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="carOfferData.isCommericialInsurance">
                                        <Radio :label="0">可以</Radio>
                                        <Radio :label="1">不可以</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="客户不想本人到店,可否：" label-position="left" :label-width="100">
                                   <Radio-group v-model="carOfferData.isWentStore">
                                        <Radio :label="0">否</Radio>
                                        <Radio :label="1">是</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="支持发票类型：" label-position="left" :label-width="100">
                                   <Checkbox-group v-model="invoicesList">
                                        <Checkbox :label="0">私户</Checkbox>
                                        <Checkbox :label="1">公开普票</Checkbox>
                                        <Checkbox :label="2">增票</Checkbox>
                                    </Checkbox-group>
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
                <div slot="footer">
                    <div>
                        <Button :disabled="carOffeSubmit" type="success" style="margin:0 auto; display: block;" @click="saveCarOffer()">保存</Button>
                        <!-- <Button type="primary" @click="hideModel">取消</Button> -->
                    </div>
                </div>
            </Modal>
    </div>
    
</template>

<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'setintentionalorder',
    data () {
        return {
            followDataRules: {
                version_name: [
                    { required: true, message: '请输入版本名称', trigger: 'blur'},
                    {type: 'string', max: 15, message: '不能超过15个字符', trigger: 'blur'}
                ],
                PRICE: [
                    { required: true, message: '价格不能为空', trigger: 'blur'}
                ],
                DOWN_PAYMENT: [
                    { required: true, message: '请输入定金', trigger: 'blur'}
                ],
                RESERVE_INFO: [
                    { required: true, message: '请输入现车/预定详情', trigger: 'blur'},
                    {type: 'string', max: 100, message: '不能超过100个字符', trigger: 'blur'}
                ],
                INSURANCE_INFO: [
                    { required: true, message: '请输入保险详情', trigger: 'blur'},
                    {type: 'string', max: 100, message: '不能超过100个字符', trigger: 'blur'}
                ],
                FINANCE_INFO:[
                    { required: true, message: '请输入金融详情', trigger: 'blur'},
                    {type: 'string', max: 100, message: '不能超过100个字符', trigger: 'blur'}
                ]
            },
            followData:{
                OPERATOR:'',//操作者
                OFFER_ID:'',//报价id
                PRICE:'',//最终价格
                DOWN_PAYMENT:'',//定金
                RESERVE_INFO:'',//现车及预定详情
                IS_OTHER_AREA:0,//可否跨区
                INSURANCE_INFO:'',//保险详情
                FINANCE_INFO:'',//金融详情
                IS_WENT_STORE:0,//本人是否到店
                DELIVERY_TYPE:1,//加配/送配
                IS_DECORATION:0,//是否添加装饰
                OUT_PRICE:0,//出库费
                CAR_LOCATION:'',//车源所在地
                LOGISTICS_PRICE:0,//物流金额
                PROCEDURES:'',//手续
                PRODUCT_TIME:'',//生产日期
                REMARK:''//备注
            },
            offerData:{
                price:0,//价格
                discount_AMT:0,//优惠金额
                add_AMT:0,//加价金额
                add_POINT:0,//加价点数
                discount_POINT:0,//优惠点数
                source_NAME:'',//车源方
                dealer_NAME:'',//经销商名称
                docking_POST:'',//对接人职务
                docking_PERSON:'',//对接人姓名
                docking_PHONE:'',//对接人电话
                is_AVAILABLE:0,//是否有现车
                is_COMPULSORY_INSURANCE:0,//交强险
                is_COMMERICIAL_INSURANCE:0,//商业险
                is_WENT_STORE:0,//本人到店
                remark:''//备注
            },
            pushMessage:{
                appUserId:'',//企业用户的id
                mobile:'',//手机号
                realName:''//用户的真实姓名
            },
            carOfferData:{
                userId:'',//用户id
                otherId:'',//订单id
                price:0,//汽车价格
                sourceName:'',//车源名称
                dealerName:'',//经销商名称
                dockingPost:'',//对接人职务
                dockingPerson:'',//对接人名称
                dockingPhone:'',//对接人电话
                isAvailable:0,//是否有现车 0:无1:有
                isSellArea:0,//是否可以销售到该地区 0:否1:是
                isCompulsoryInsurance:0,//是否店内上交强险 0:否1:是
                isCommericialInsurance:0,//是否店内上商业险 0:否 1:是
                isWentStore:0,//是否本人到店 0:否 1:是
                invoices:'',//发票选择发票类型 0:私户 1:公户普票 2:增票 多个以逗号隔开
                remark:''//备注
            },
            pay_columns: [
                    {
                        title: '支付方式',
                        align: 'center',
                        key: 'payType',
                        render: (h, params) => {
                            if (params.row.payType === 1) {
                                return h('span', '支付宝')
                            }else if(params.row.payType === 2) {
                                return h('span', '微信')
                            }
                        }
                    },
                    {
                        title: '支付编号',
                        align: 'center',
                        key: 'payNo'
                    },
                    {
                        title: '充值用途',
                        align: 'center',
                        key: 'useWay',
                        render: (h, params) => {
                            if (params.row.useWay === 1) {
                                return h('span', '意向金')
                            }else {
                                return h('span', '其他')
                            }
                        }
                    },
                    {
                        title: '状态',
                        align: 'center',
                        key: 'status',
                        render: (h, params) => {
                            if (params.row.status === 0) {
                                return h('span', '未支付')
                            }else if(params.row.status === 1) {
                                return h('span', '支付成功')
                            }else if(params.row.status === 2) {
                                return h('span', '支付失败')
                            }else if(params.row.status === 3) {
                                return h('span', '退款中')
                            }else if(params.row.status === 4) {
                                return h('span', '已退款')
                            }
                        }
                    },
                    {
                        title: '金额',
                        align: 'center',
                        key: 'price'
                    },
                    {
                        title: '支付时间',
                        align: 'center',
                        key: 'crtTime'
                    }
                ],
            push_columns: [
                    {
                        title: '监管员管理',
                        align: 'center',
                        key: 'supervisor_manager'
                    },
                    {
                        title: '管理电话',
                        align: 'center',
                        key: 'manager_phone'
                    },
                    {
                        title: '监管员',
                        align: 'center',
                        key: 'supervisor_name'
                    },
                    {
                        title: '监管员电话',
                        align: 'center',
                        key: 'supervisor_phone'
                    },
                    {
                        title: '车源价格',
                        align: 'center',
                        key: 'price'
                    },
                    {
                        title: '经销商',
                        align: 'center',
                        key: 'supervisory_store'
                    }
                ],
                feedback_columns: [
                    {
                        title: '经销商',
                        align: 'center',
                        key: 'dealer_NAME'
                    },
                    {
                        title: '对接人职务',
                        align: 'center',
                        key: 'docking_POST'
                    },
                    {
                        title: '对接人姓名',
                        align: 'center',
                        key: 'docking_PERSON'
                    },
                    {
                        title: '对接人电话',
                        align: 'center',
                        key: 'docking_PHONE'
                    },
                    {
                        title: '车源方',
                        align: 'center',
                        key: 'source_NAME'
                    },
                    {
                        title: '价格',
                        align: 'center',
                        key: 'price'
                    },
                    {
                        title: '是否推送',
                        align: 'center',
                        key: 'is_PUSH',
                        render: (h, params) => {
                            if (params.row.is_PUSH === 0) {
                                return h('span', '否')
                            }else if(params.row.is_PUSH === 1) {
                                return h('span', '是')
                            }
                        }
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 180,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h(
                                    'Button',
                                    {
                                        props: {
                                            type: 'info',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight:'5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.confirm(params.row.id)
                                            }
                                        }
                                    },
                                    '确认'
                                ),
                                h(
                                    'Button',
                                    {
                                        props: {
                                            type: 'info',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight:'5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.offerDataInfo(params.row.id)
                                            }
                                        }
                                    },
                                    '查看详情'
                                )
                            ])
                        }
                    }
                ],
            push_data: [],//已推送人员信息
            push_count:0,//推送人员的总记录数
            pay_data: [],//支付记录列表
            feedback_data: [],//反馈车源列表
            feedback_count:0,//反馈车源的总记录数
            orderNo:'',//订单编号
            offerId:'',//发布寻车编号
            userId:'',//当前登录者的编号
            areaList:[],//省的集合
            areaCityList:[],//市的集合
            testModelShow:false,
            offerDataModel:false,
            pushMessageModel:false,//推送消息的弹层显示
            symptomList:[],
            selectModel:[],
            partys:[],//企业的集合
            users:[],//手机端用户的集合
            orderData: {
                id:'',
                order_no:'',
                source_id:'',
                source_brand: '',
                source_model:'',
                out_color:'',
		        in_color:'',
                user_id:'',
                user_name:'',
                user_phone:'',
                STATUS:'',
                intention_money:'',
                province:'',
                city:'',
                guidance_price:0,
                price:0
            },
            hasSubmit: false,
            carOffeSubmit: false,
            orderStatus:-1,
            testModel: false,
            carOfferModel: false,
            invoicesList:[]//发票的集合
        }
    },
    methods: {
        // 数据初始化
        init () {
            var userId = window.localStorage.getItem('userId')
            this.userId = userId
            this.$store.commit('setActiveName', 'intentionalorderindex');
            var id = this.$route.params.id;
            this.orderNo = this.$route.params.id;
            this.selectById(id);

        },
        selectById(id){
            var _that = this;
            var url = 'adminlogin/carorder/selectById';
            var data = {
                orderId: id
            };
            ajax.formRes(url, data).then(function (res) {
                if (200 == res.code) {
                    _that.orderData = res.data;
                    _that.feedback_data = res.offers;
                    _that.feedback_count = res.offerCount;
                    _that.push_data = res.supervisor;
                    _that.push_count = res.supervisorCount;
                    _that.areaList = res.area;
                    _that.pay_data = res.payData;
                } else {
                    _that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(function (res) {
                console.log('有错误信息');
            });
        },
        setArea(obj){
            this.areaCityList = obj.citys;
        },
        //新增车源
        addCarSource(){
           this.$store.commit('setActiveName', 'carsourceindex');
        },
        push_refresh(){
            this.push_data = []
            this.push_count = 0
            this.pushDataList(1)
        },
        //显示推送信息
        push_message(){
            let that = this
            let url = 'adminlogin/carorder/selectUserInfos'
            let data = {}
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    that.partys = res.partys
                    that.pushMessageModel = true
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        setPartyUser(obj){
            this.users = obj.users;
        },
        defineUser(obj){
            this.pushMessage.appUserId = obj.id
            this.pushMessage.mobile = obj.mobile
            this.pushMessage.realName = obj.realName
            this.pushMessage.managerName = obj.managerName
            this.pushMessage.managerMobile = obj.managerMobile
            this.pushMessage.distributor = obj.distributor
        },
        confirmPush(){//确认推送
            let that = this
            let url = 'adminlogin/carorder/confirmPush'
            let data = {
                orderId: that.orderNo,
                appUserId:that.pushMessage.appUserId,
                mobile:that.pushMessage.mobile,
                sourceId:that.orderData.source_id,
                outColor:that.orderData.out_color,
                inColor:that.orderData.in_color,
                realName:that.pushMessage.realName,
                managerName:that.pushMessage.managerName,
                managerMobile:that.pushMessage.managerMobile,
                distributor:that.pushMessage.distributor
            }
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                   that.pushMessageModel = false
                   that.pushDataList(1)
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        //发布报价设置
        carOfferUser(obj){
            this.carOfferData.userId = obj.id
            
        },
        carOfferShow(){
            let that = this
            let url = 'adminlogin/carorder/selectUserInfos'
            let data = {}
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    that.partys = res.partys
                    that.carOfferModel = true
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        saveCarOffer(){//保存寻车报价
            this.carOffeSubmit = true
            this.carOfferData.otherId = this.orderNo
            this.carOfferData.invoices = this.invoicesList.join(",")
            
            //saveCarOffer
            let that = this
            let url = 'adminlogin/carorder/saveCarOffer'
            let data = this.carOfferData
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    that.carOfferModel = false
                    that.feedback_refresh()
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        //二次确认
        confirm(id){
            this.followData = {
                OPERATOR:'',//操作者
                OFFER_ID:'',//报价id
                PRICE:'',//最终价格
                DOWN_PAYMENT:'',//定金
                RESERVE_INFO:'',//现车及预定详情
                IS_OTHER_AREA:0,//可否跨区
                INSURANCE_INFO:'',//保险详情
                FINANCE_INFO:'',//金融详情
                IS_WENT_STORE:0,//本人是否到店
                DELIVERY_TYPE:1,//加配/送配
                IS_DECORATION:0,//是否添加装饰
                OUT_PRICE:0,//出库费
                CAR_LOCATION:'',//车源所在地
                LOGISTICS_PRICE:0,//物流金额
                PROCEDURES:'',//手续
                PRODUCT_TIME:'',//生产日期
                REMARK:''//备注
            }
            this.testModel = true
            this.offerId = id
        },
        //根据订单id获取订单的详细信息
        selectOrderById(){
            let that = this
            let url = 'adminlogin/carorder/selectOrderById'
            let data = {
                orderId: that.orderNo
            }
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    that.orderStatus = res.order.status;
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        //二次确认提交
        confirmation(){
            let that = this
            that.selectOrderById()
            //验证该订单是否已经取消
            if(that.orderStatus === 9){
                that.$Message.success('该订单用户已取消，不能进行二次确认，请关闭页面。');
            }else{
                that.$refs['followData'].validate((valid) => {
                    if (valid) {
                        that.hasSubmit = true
                        let url = 'adminlogin/carorder/confirmation'
                        that.followData.orderNo = that.orderNo
                        that.followData.OPERATOR = that.userId
                        that.followData.OFFER_ID = that.offerId
                        let data = that.followData
                        ajax.formRes(url, data).then(res => {
                            that.$Message.success('页面正在跳转至订单列表页面')
                            that.hasSubmit = false
                            that.testModel = false
                            let argu = {}
                            that.$router.push({
                                name: 'intentionalorderindex',
                                params: argu
                            })
                        }).catch(res => {
                            console.log('有错误信息')
                            // fail
                        })
                    } else {
                        console.log('新增失败。。。')
                    }
                })
            }
        },
        
        pushDataList (page) {
            let _that = this;
            var url = 'adminlogin/carorder/selectSupervisorByOrderId';
            let data = {
                orderId: _that.orderNo,
                pageSize: 10,
                pageNum: page
            }
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    _that.push_data = res.supervisor;
                    _that.push_count = res.supervisorCount;
                } else {
                    _that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
            })
        },
        //刷新反馈车源
        feedback_refresh(){
            this.feedback_data = []
            this.feedback_count = 0
            this.feedbackList(1)
        },
        feedbackList (page) {
            let _that = this;
            var url = 'adminlogin/carorder/selectOfferByOrderNo';
            let data = {
                orderId: _that.orderNo,
                pageSize: 10,
                pageNum: page
            }
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                    _that.feedback_data = res.offers;
                    _that.feedback_count = res.offerCount;
                } else {
                    _that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        // 修改数据
        updateData () {
            let that = this
            that.$refs['versionData'].validate((valid) => {
                if (valid) {
                    that.hasSubmit = true
                    let url = 'adminlogin/version/updateById'
                    let data = that.versionData
                    ajax.formRes(url, data).then(res => {
                        // success
                        that.$Message.success('新增数据成功,页面正在跳转')
                        that.hasSubmit = false
                            let argu = {
                            }
                            that.$router.push({
                                name: 'appversionindex',
                                params: argu
                            })
                    }).catch(res => {
                        console.log('有错误信息')
                        // fail
                    })
                } else {
                    console.log('新增失败123123。。。')
                }
            })
        },
        offerDataInfo (offerId) {
            
            let _that = this
            var url = 'adminlogin/carorder/offerDataInfoById'
            let data = {
                offerId: offerId,
            }
            ajax.formRes(url, data).then(res => {
               if (200 == res.code) {
                   _that.offerDataModel = true
                    _that.offerData = res.data
                } else {
                    _that.$Message.success('数据原因，请联系管理员。')
                }
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        goBack () {
            this.$router.push({
                name: 'intentionalorderindex'
            })
        }
        
    },
    created: function () {
        this.init()
    },
    activated: function () {
       this.init()
    }
}
</script>
<style>
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .card-upload:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
    .demo-spin-icon-load{
        animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
        from { transform: rotate(0deg);}
        50%  { transform: rotate(180deg);}
        to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
        height: 100px;
        position: relative;
        border: 1px solid #eee;
    }
    .small-title{
        font-style: normal;
        font-weight: bold;
        font-size:14px;
    }
</style>

